home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / OutOfPhase1.01Source / OutOfPhase Folder / Level 1 Extensions 20Jul94 / IconButton.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-01  |  2.9 KB  |  79 lines  |  [TEXT/KAHL]

  1. /* IconButton.h */
  2.  
  3. #ifndef Included_IconButton_h
  4. #define Included_IconButton_h
  5.  
  6. /* IconButton module depends on */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* Screen */
  12. /* Memory */
  13. /* EventLoop */
  14.  
  15. /* IconButton provides a flexible picture-based button.  It can behave like a */
  16. /* checkbox (toggled) or a radio button (family), or a simple button (no state). */
  17.  
  18. #include "Screen.h"
  19.  
  20. struct IconButtonRec;
  21. typedef struct IconButtonRec IconButtonRec;
  22.  
  23. /* these determine how the button behaves when clicked on */
  24. typedef enum
  25.     {
  26.         eIconRadioMode EXECUTE(= -9),
  27.         eIconCheckMode,
  28.         eIconSimpleMode
  29.     } IconButtonModes;
  30.  
  31. /* allocate a new icon button.  This one is used if the button should convert */
  32. /* the specified raw images into internal bitmaps. */
  33. IconButtonRec*    NewIconButtonRawBitmaps(WinType* Window, OrdType X, OrdType Y,
  34.                                     OrdType Width, OrdType Height, char* RawUnselected,
  35.                                     char* RawUnselectedMouseDown, char* RawSelected,
  36.                                     char* RawSelectedMouseDown, int BytesPerRow,
  37.                                     IconButtonModes WhatMode);
  38.  
  39. /* allocate a new icon button.  this one is used if the bitmaps are already */
  40. /* allocated and you just want to use them.  when disposed, the bitmaps will NOT */
  41. /* be disposed. */
  42. IconButtonRec*    NewIconButtonPreparedBitmaps(WinType* Window, OrdType X, OrdType Y,
  43.                                     OrdType Width, OrdType Height, Bitmap* Unselected,
  44.                                     Bitmap* UnselectedMouseDown, Bitmap* Selected,
  45.                                     Bitmap* SelectedMouseDown, IconButtonModes WhatMode);
  46.  
  47. /* dispose the button, and the bitmaps if appropriate */
  48. void                        DisposeIconButton(IconButtonRec* TheButton);
  49.  
  50. /* find out where the icon button is */
  51. OrdType                    GetIconButtonXLoc(IconButtonRec* TheButton);
  52. OrdType                    GetIconButtonYLoc(IconButtonRec* TheButton);
  53. OrdType                    GetIconButtonWidth(IconButtonRec* TheButton);
  54. OrdType                    GetIconButtonHeight(IconButtonRec* TheButton);
  55.  
  56. /* change the location of the icon button */
  57. void                        SetIconButtonLocation(IconButtonRec* TheButton, OrdType X, OrdType Y);
  58.  
  59. /* do a full redraw of the button */
  60. void                        RedrawIconButton(IconButtonRec* TheButton);
  61.  
  62. /* handle a mouse down in the button.  returns True if the state of the button */
  63. /* changed.  (or if the mouse went up inside the button, if it is in simple */
  64. /* button mode.)  If Tracking != NIL, then it will be repeatedly called, with */
  65. /* the Inside status until the mouse goes up. */
  66. MyBoolean                IconButtonMouseDown(IconButtonRec* TheButton, OrdType X, OrdType Y,
  67.                                     void (*Tracking)(void* Refcon, MyBoolean Inside), void* Refcon);
  68.  
  69. /* if the button is a stateful button, this forces the state to a value */
  70. void                        SetIconButtonState(IconButtonRec* TheButton, MyBoolean TheState);
  71.  
  72. /* get the value of the state variable */
  73. MyBoolean                GetIconButtonState(IconButtonRec* TheButton);
  74.  
  75. /* see if the specified location is within the bounds of the button */
  76. MyBoolean                IconButtonHitTest(IconButtonRec* TheButton, OrdType X, OrdType Y);
  77.  
  78. #endif
  79.